<template>
	<div>
		<div class="pub-title">后台管理</div>
		<ul class="pub-tab">
			<li class="option-list">
				<a href="article.html" class="option on">网站消息管理</a>
				<!-- <a href="article_classify.html" class="option">分类</a> -->
			</li>
			<li class="tab-block-list">
				<div class="pub-form-line">
					<div class="pub-form-line-left sign">标题</div>
					<div class="pub-form-line-right">
						<input type="text" class="pub-input" v-model="sysmsg.title" />
					</div>
				</div>
				<div class="pub-form-line">
					<div class="pub-form-line-left sign">消息显示类型</div>
					<div class="pub-form-line-right">
						<select v-model="sysmsg.showModel">
							<option value="0">不展示</option>
							<option value="1">每天展示一次</option>
							<option value="2">每次启动展示</option>
						</select>
					</div>
				</div>
				<div class="pub-form-line">
					<div class="pub-form-line-left sign">内容</div>
					<div class="pub-form-line-right">
						<textarea v-model="sysmsg.content" class="text" style="width:500px;height:100px;"></textarea>
					</div>
				</div>
				
				<div class="pub-form-line">
					<div class="pub-form-line-left"></div>
					<div class="pub-form-line-right">
						<button class="pub-btn pub-btn-bgred pub-btn-big" @click="submit">提交</button>
					</div>
				</div>
				
			</li>
		</ul>
	</div> 
</template> 

<script>
	var _this;
	module.exports = {
		data: function() {
			return {
				sysmsg: {
					title:'',
					content:"",
					showModel:0//0.不展示 1.每天展示一次 2.每次启动展示
				},
			} 
		},  
		
		methods: {			
			submit() {
				ajax({
					url: 'sysmsg/update',
					data: this.sysmsg,
					type: 'post',
					success: function(res) {					
						UI.alert(res.msg);
					} 
				}) 
			},  
		},
		created() {
			_this=this;
			ajax({
				url: "sysmsg/get", 					
				success: function(res) {
					if (res.state == 1) {
						res.data.showModel=!res.data.showModel?0:res.data.showModel;
						delete res.data.datetime;
						_this.sysmsg=res.data;
					} else {
						UI.alert(res.msg); 
					}
				}
			})
		}
	}
</script>
